//
//  CZQClubDetailVC.m
//  coachmanage
//
//  Created by 众拳科技 on 2018/3/22.
//  Copyright © 2018年 众拳科技. All rights reserved.
//

#import "CZQClubDetailVC.h"
#import "CZQClubDetailTCell.h"
@interface CZQClubDetailVC ()<UITableViewDataSource,UITableViewDelegate>
/**
 //数据源
 */
@property(nonatomic,strong)NSMutableArray *dataArr;

/**
 tableView
 */
@property(nonatomic,weak)UITableView *tableView;

@property(nonatomic,weak)CZQClubDetailHeadView *headView;
@end

@implementation CZQClubDetailVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"场地详情";
    
    [self tableView];
    
    // Do any additional setup after loading the view.
}


#pragma mark -- 懒加载

-(NSMutableArray *)dataArr
{
    if (!_dataArr) {
        
        _dataArr = [NSMutableArray array];
        
    }
    
    return _dataArr;
}

-(UITableView *)tableView
{
    if (!_tableView) {
        
        UITableView *tableView=[[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStyleGrouped];
        
        tableView.delegate=self;
        
        tableView.dataSource=self;
        
        tableView.backgroundColor = BackGroundColor;
        
        tableView.estimatedRowHeight = 150;
        
        [self.view addSubview:tableView];
        
        [tableView mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.edges.mas_equalTo(self.view);
            
        }];
        
        tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        
        
        //注册
        [tableView registerClass:[CZQClubDetailTCell class] forCellReuseIdentifier:@"cell"];
        
        CZQClubDetailHeadView *headView = [[CZQClubDetailHeadView alloc] init];
        
        [self.view addSubview:headView];
        
        self.headView = headView;
        [headView mas_remakeConstraints:^(MASConstraintMaker *make) {
            
            make.top.mas_equalTo(tableView);
            
            make.left.width.mas_equalTo(self.view);
        }];
        
        [headView setNeedsLayout];
        [headView layoutIfNeeded];
        
        tableView.tableHeaderView = headView;
        
        _tableView = tableView;
    }
    return _tableView;
}

#pragma mark - UITableViewDataSource

//行数
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

//列数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}

//cell内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    CZQClubDetailTCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    
    
    
    return cell  ;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 50;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.00001;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    return [[UIView alloc]initWithFrame:CGRectZero];
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    CZQClubDetailSettionHeadView *cectionHead = [CZQClubDetailSettionHeadView new];
    
    return cectionHead;
}



-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //当离开某行时，让某行的选中状态消失
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
